package com.scott.itcast.timer.lesson04;

import java.util.Date;
import java.util.Timer;
import java.util.TimerTask;

/**
 * 定时器  炸弹里面还有炸弹 子母弹
 */
public class TraditionalTimer {
	
	@SuppressWarnings("deprecation")
	public static void main(String[] args) {
		
		
		
		
		//2秒之后炸
		new Timer().schedule(new TimerTask() {
			@Override
			public void run() {
				System.out.println("母炸弹 bombing...");
				
				new Timer().schedule(new TimerTask() {
					@Override
					public void run() {
						System.out.println("子炸弹 bombing...");
					}
				}, 2000);
			}
		}, 2000);
		
		
		
		while(true){
			System.out.println(new Date().getSeconds());
			try {
				Thread.sleep(1000);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
	}

}
